home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / vol15n11.zip / HKD.ZIP / HKDSRC.ZIP / HKD.CPP < prev    next >
C/C++ Source or Header  |  1996-03-23  |  2KB  |  78 lines

  1. // HKD.cpp : Defines the class behaviors for the application.
  2.  
  3. // HotKey Detective version 1.0
  4. // Copyright (c) 1996 Ziff-Davis Publishing
  5. // First published in PC Magazine June 11, 1996
  6. // Author: Gregory A. Wolking
  7.  
  8. #include "stdafx.h"
  9. #include "HKD.h"
  10. #include "HKDdlg.h"
  11.  
  12. #ifdef _DEBUG
  13. #undef THIS_FILE
  14. static char BASED_CODE THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CHKDApp
  19.  
  20. BEGIN_MESSAGE_MAP(CHKDApp, CWinApp)
  21.     //{{AFX_MSG_MAP(CHKDApp)
  22.         // NOTE - the ClassWizard will add and remove mapping macros here.
  23.         //    DO NOT EDIT what you see in these blocks of generated code!
  24.     //}}AFX_MSG
  25.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CHKDApp construction
  30.  
  31. CHKDApp::CHKDApp()
  32. {
  33.     // TODO: add construction code here,
  34.     // Place all significant initialization in InitInstance
  35. }
  36.  
  37. /////////////////////////////////////////////////////////////////////////////
  38. // The one and only CHKDApp object
  39.  
  40. CHKDApp theApp;
  41.  
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CHKDApp initialization
  44. //////////////////////////////
  45. // Note that I have "gutted" most of the App Wizard-generated code from
  46. // this function since I'm not using CHKDDlg as a "traditional" dialog box.
  47. // In particular, I don't care about the dialog's return value; it doesn't
  48. // matter how the user chose to exit the dialog. All code in this file 
  49. // other than this function was generated by the App Wizard.
  50. //////////////////////////////
  51. BOOL CHKDApp::InitInstance()
  52. {
  53.     ATOM myAtom;
  54.  
  55.     // See if our atom exists in the global atom table.
  56.     if (GlobalFindAtom("HKD Active"))
  57.     {
  58.         // If it does, we're already running so present a message and shut down.
  59.         MessageBox(NULL, "You may only run one instance of this program", "HotKey Detective", MB_OK);
  60.         return FALSE;
  61.     }
  62.     else
  63.     {
  64.         // Otherwise, we're the only instance so install our atom.
  65.         myAtom = GlobalAddAtom("HKD Active");
  66.     }
  67.     Enable3dControls();
  68.     // Create an instance of our main dialog.
  69.     CHKDDlg dlg;
  70.     m_pMainWnd = &dlg;
  71.     // Display it as a modal window.
  72.     dlg.DoModal();
  73.     // Remove our atom from the global atom table.
  74.     GlobalDeleteAtom(myAtom);
  75.     // Return FALSE to shut down the application.
  76.     return FALSE;
  77. }
  78.